package cn.zcf.downgrade;

import cn.zcf.domain.User;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import org.springframework.web.bind.annotation.PathVariable;

public class DowngradeUtil {

    /*
     * @Description: 服务降级方法
     * @Author: Director
     * @Date: 2022/7/30 23:26
     * @param id:
     * @param e: 服务降级方法必须接收的异常参数
     * @return: cn.itsource.domain.User
     **/
    public static User degradationMethod(@PathVariable("id") Long id, BlockException e){
        e.printStackTrace();
        return new User(-1L, "服务降级触发！", "当前服务流量过大，请稍后重试！");
    }

}